package org.posupe.distribuicao;

import java.io.PrintStream;
import java.io.PrintWriter;

public class ComunicacaoException extends Exception {

    private Throwable exception;
    
    public ComunicacaoException(Throwable ex) {
        while (ex instanceof ComunicacaoException) {
            ex = ((ComunicacaoException)ex).getException();
        }
        
        exception = ex;
    }
    
    public Throwable fillInStackTrace() {
        return this.exception.fillInStackTrace();
    }

    public String getLocalizedMessage() {
        return this.exception.getLocalizedMessage();
    }

    public String getMessage() {
        return this.exception.getMessage();
    }

    public void printStackTrace() {
        this.exception.printStackTrace();
    }    
    
    public void printStackTrace(PrintStream s) {
        this.exception.printStackTrace(s);
    }
    
    public void printStackTrace(PrintWriter s) {
        this.exception.printStackTrace(s);
    }    

    public String toString() {
        return this.exception.toString();
    }
    
    public Throwable getException() {
        return this.exception;
    }    
        
}

